package com.qianya.system.manage.web.sys.controller;

import com.qianya.model.pojo.sys.vo.SysLogVO;
import com.qianya.system.manage.web.sys.mapper.SysLogMapper;
import com.qianya.system.manage.web.sys.model.SysLog;
import com.qianya.system.manage.web.sys.service.ISysLogService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.web.bind.annotation.*;
import org.springframework.beans.BeanUtils;
import com.qianya.model.common.CommonResult;
import com.qianya.model.pojo.sys.qo.SysLogQO;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.validation.constraints.NotBlank;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 登录日志 前端控制器
 * </p>
 *
 * @author lhl
 * @since 2020-06-10
 */
@RestController
@RequestMapping("/sys/sys-log")
@Api(value = "SysLogController", tags = "系统设置-登录/异常日志")
@Slf4j
public class SysLogController {


    @Autowired
    private ISysLogService sysLogService;

    //kbXj7zi3MCHFuoSfmzwdvSaCwd5iFpOf 125.85.201.249
    @PostMapping(value = "/create")
    @ApiOperation("添加登录日志")
    public CommonResult save(@RequestBody SysLogQO sysLogQO, HttpServletRequest request) {

        SysLog sysLog = new SysLog();

        BeanUtils.copyProperties(sysLogQO, sysLog);

        return sysLogService.create(sysLog, request);
    }

    @ApiOperation("查找登录日志")
    @GetMapping(value = "/find")
    public CommonResult find(SysLogQO sysLogQO, HttpServletRequest request) {
        return sysLogService.find(sysLogQO);
    }






}
